02. Java Keywords

Java Keywords

ND079 C1 L1 A02 Java Keywords Video

If we want to build an application in Java, we first need to know the basic vocabulary of the language. This vocabulary is made up of what we call keywords.

Keywords are simply words that have a predefined meaning in the Java language.

Java has 51 keywords, as shown in the table below.

Java Keywords
abstract continue for new super
assert default goto null switch
boolean do if package synchronized
break double implements private this
byte else import protected throw
case enum instanceof public throws
catch extends int return transient
char final interface short try
class finally long static void
const float native strictfp volatile
while

You don't need to memorize these—you will get familiar with many of them in this course, and the rest you can always look up if you need them. But the key thing to remember is that these words already have a meaning in Java, so they are reserved. That means you cannot use them when you are naming your own variables, methods or classes.

Which of the following are true statements about keywords?

(Select all that apply.)

SOLUTION:
  • They are reserved words in the Java Language
  • They cannot be used as identifiers (e.g., when naming variables, classes, or methods)
  • There are 51 keywords in Java